/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

var LoaderComponent = "<div id='loading' style='display:none'><img src='/css/ajax-loader.gif' alt='Loading'/></div>";
$('#btnGo').click(crawlURL);

function crawlURL() {
    URL = $('#txtURL').val();
    console.log(URL);
    $('#loading').css('display','');
    $.ajax({
        type: "POST",
        url: "/Crawler/Crawler.php",
        dataType: "text",
        data: "URL="+URL,
        success: function(response) {
            $('#loading').css('display','none');
            response = LoaderComponent + response;
            $('#result').html(response).text();
            //console.log(response);
        },
        error: function(xhr, textStatus, errorThrown) {
            feedbackMessage('Error!  Status = ' + xhr.status);
        }
    });
    return false;
}